import React, { Children, lazy } from "react";
import { Navigate } from "react-router-dom";
const AccountSafety = lazy(() => import("../pages/MySelf/AccountSafety"));
const MyPage = lazy(() => import("../pages/MySelf/MyPage"));
const LoginCode = lazy(() => import("../pages/Login/LoginCode"));
const PasswordLogin = lazy(() => import("../pages/Login/PasswordLogin"));
const VerifyCode = lazy(() => import("../pages/Login/VerifyCode"));
const RouterOutlet = lazy(() => import("../pages/RouterOutlet"));
const SelfMessage = lazy(() => import("../pages/MySelf/SelfMessage"));
const PutUser = lazy(() => import("../pages/MySelf/PutUser"));
const ConfigPage = lazy(() => import("../pages/MySelf/ConfigPage"));
const PutOldPassword = lazy(() => import("../pages/MySelf/PutOldPassword"));
const PutNewPassword = lazy(() => import("../pages/MySelf/PutNewPassword"));
const GetCodePassword = lazy(() => import("../pages/MySelf/GetCodePassword"));
const PutPhone = lazy(() => import("../pages/MySelf/PutPhone"));
const ShowCollect = lazy(() => import("../pages/MySelf/ShowCollect"));
const AiTask = lazy(() => import("../pages/MySelf/AiTask"));
const OrderPage = lazy(()=>import('../pages/Order/OrderPage'))
const Pay = lazy(()=>import('../pages/Order/OrderPay'))
const Success = lazy(()=>import('../pages/Order/Success'))
// 刘旭的分支
const Ship = lazy(() => import("../pages/Lx-branch/views/ShipAddress"));
const ADDa = lazy(() => import("../pages/Lx-branch/views/AddAddress")); //新增地址
const Location_selection = lazy(() =>
  import("../pages/Lx-branch/views/Location_selection")
); // 地址选择
const Mes = lazy(() => import("../pages/Lx-branch/views/Message"));
const Act = lazy(() => import("../pages/Lx-branch/views/Activity"));
const Actd = lazy(() => import("../pages/Lx-branch/views/Activity_Detail")); // 活动详情
const Orders = lazy(() => import("../pages/Lx-branch/views/Order-not")); // 订单
const Chat = lazy(() => import("../pages/Lx-branch/views/Chat")); // 聊天
const Comment = lazy(() => import("../pages/Lx-branch/views/Comment")); // 评论

const Home = lazy(() => import('../pages/Home/Home'))
const Car = lazy(() => import('../pages/Home/Car'))
const Detail = lazy(() => import('../pages/Home/Detail'))
const Find = lazy(() => import('../pages/Home/Find'))
const Order = lazy(() => import('../pages/Home/Order'))
const Shop1 = lazy(() => import('../pages/Home/Shop1'))
const Shop2 = lazy(() => import('../pages/Home/Shop2'))
const Type = lazy(() => import('../pages/Home/Type'))
const Type1 = lazy(() => import('../pages/Home/Type1'))

import A from "../pages/Login/A";
import AuthRouter from "./AuthRouter";
const isToken = sessionStorage.getItem("isToken");
const routers = [
  { path: "/", element: <Navigate to="/outlet/MySelf" /> },

  {
    path: "/outlet",
    element: <AuthRouter children={<RouterOutlet />} />,
    children: [
      {
        path: "MySelf",
        element: <MyPage />,
      },
      {
        path: "selfMessage",
        element: <SelfMessage />,
      },
      {
        path: "putUser",
        element: <PutUser />,
      },
      {
        path: "configMessage",
        element: <ConfigPage />,
      },
      {
        path: "accountSafety",
        element: <AccountSafety />,
      },
      {
        path: "putOldPassword",
        element: <PutOldPassword />,
      },
      {
        path: "putNewPassword",
        element: <PutNewPassword />,
      },
      {
        path: "getCodePassword",
        element: <GetCodePassword />,
      },
      {
        path: "putPhone",
        element: <PutPhone />,
      },
      {
        path: "showCollect",
        element: <ShowCollect />,
      },
      {
        path: "AiTask",
        element: <AiTask />,
      },
      {
        path: "ship",
        element: <Ship />,
      }, // 地址
      {
        path: "addA",
        element: <ADDa />,
      }, // 新增地址
      {
        path: "loc",
        element: <Location_selection />,
      }, // 地址选择
      {
        path: "message",
        element: <Mes />,
      },
      {
        path: "act",
        element: <Act />,
      },
      {
        path: "actd",
        element: <Actd />,
      },
      {
        path: "ord-lx",
        element: <Orders />,
      },
      {
        path: "chat",
        element: <Chat />,
      },
      {
        path: "com",
        element: <Comment />,
      },
      {
        path:'orderpage',
        element:<OrderPage/>
    },

    {
        path:'pay',
        element:<Pay/>
    },
    {
        path:'success',
        element:<Success/>
    },
    {
        path:"home",
        element:<Home />
    },
    {
        path:"car",
        element:<Car />
    },
    {
        path:"detail",
        element:<Detail />
    },
    {
        path:"find",
        element:<Find />
    },
    {
        path:"order",
        element:<Order />
    },
    {
        path:"shop1",
        element:<Shop1 />
    },
    {
        path:"shop2",
        element:<Shop2 />
    },
    {
        path:"type",
        element:<Type />
    },
    {
        path:"type1",
        element:<Type1 />
    },
    ],
  },
  { path: "/loginCode", element: <LoginCode /> },
  { path: "/passwordLogin", element: <PasswordLogin /> },
  { path: "/verifyCode", element: <VerifyCode /> },
  { path: "/a", element: <A /> },
];
export default routers;
